﻿using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using WidgetsDesign.API.Hubs;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace WidgetsDesign.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ConferenceController : ControllerBase
    {
        private readonly IHubContext<ChatHub> _hubContext;
        private readonly ILogger<ConferenceController> _logger;
        private static int count = 0;
        public ConferenceController(ILogger<ConferenceController> logger, IHubContext<ChatHub> hubContext)
        {
            _logger = logger;
            _hubContext = hubContext;
        }
        [HttpGet("pushMsg")]
        public async Task<IActionResult> PushMsg([FromQuery] string content)
        {
            await _hubContext.Clients.All.SendAsync("ShowMsg",new {code=200,data = content}) ;
                return Ok(content);
        }
    }

}
